class Database < ActiveRecord::Base
  has_many :sql_orders
  validates :env, inclusion: { in: %w(production predeploy test development) }
  validates :dbname, presence: true
  validates :address, format: { with: /\A((\d|[01]?\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[01]?\d\d|2[0-4]\d|25[0-5])\z/,
      message: "not a valid IP address" }
  validates :port, presence: true
  validates :user, presence: true
  validates :password, presence: true
end
